<template>
	<view class="bg-white" :style="{height:screenHeight+'px'}">
		<cu-custom bgColor="bg-white" :isBack="true">
			<block slot="content">新增</block>
		</cu-custom>
		<view style="background-color: #fff; padding: 15px;">
			<form>
				<view>
					<image style="width: 100rpx;height: 100rpx;" :src="dataObj.avatar"></image>
				</view>
				<view class="cu-form-group">
					<view class="title" style="font-size: 16px;">姓名</view>
					<!--					<my-select range-key="text" value-key="value" dict-code="sys_user,realname,id" v-model="userId" />-->
					<my-seach-select range-key="text" value-key="value" dict-code="sys_user,realname,id"
						v-model="userId" />
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">工号</view>
					<input disabled v-model="dataObj.workNumber" placeholder="请输入" name="input"
						style="margin-left: 20px;"></input>
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">电话</view>
					<input disabled v-model="dataObj.phone" placeholder="请输入" name="input"
						style="margin-left: 20px;"></input>
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">出生年月</view>
					<input disabled v-model="dataObj.birthday" placeholder="请输入" name="input"
						style="margin-left: 20px;"></input>
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">进厂时间</view>
					<input disabled v-model="dataObj.inTime" placeholder="请输入" name="input"
						style="margin-left: 20px;"></input>
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">年龄</view>
					<input disabled v-model="dataObj.age" placeholder="请输入" name="input"
						style="margin-left: 20px;"></input>
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">身份证号</view>
					<input disabled v-model="dataObj.username" placeholder="请输入" name="input"
						style="margin-left: 20px;"></input>
				</view>

				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">公司</view>
					<input disabled v-model="dataObj.company_dictText" placeholder="请输入" name="input"
						style="margin-left: 20px;"></input>
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">部门</view>
					<input disabled v-model="dataObj.departIds_dictText" placeholder="请输入" name="input"
						style="margin-left: 20px;"></input>
				</view>
				
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">职务</view>
					<input disabled v-model="dataObj.post" placeholder="请输入" name="input"
						style="margin-left: 20px;"></input>
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">工龄</view>
					<input disabled v-model="dataObj.workAge" placeholder="请输入" name="input"
						style="margin-left: 20px;"></input>
				</view>

				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">进厂时间</view>
					<input v-model="dataObj.inTime" placeholder="请输入" name="input" style="margin-left: 20px;"
						disabled />
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">岗位</view>
					<input v-model="dataObj.post" placeholder="请输入" name="input" style="margin-left: 20px;" disabled />
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">分类</view>
					<input v-model="dataObj.classification" placeholder="请输入" name="input" style="margin-left: 20px;"
						disabled />
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">班次</view>
					<input v-model="dataObj.classes" placeholder="请输入" name="input" style="margin-left: 20px;"
						disabled />
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">部门编码名称</view>
					<input v-model="dataObj.departName" placeholder="请输入" name="input" style="margin-left: 20px;"
						disabled />
				</view>
				<view class="cu-form-group margin-top" style="background-color: #F4F4F4;border-radius: 10px;">
					<view class="title" style="font-size: 16px;">计费标准</view>
					<input v-model="dataObj.freightBasis_dictText" placeholder="请输入" name="input"
						style="margin-left: 20px;" disabled />
				</view>
			</form>
			<view style="padding: 15rpx;margin-top: 10rpx;">
				<view class="action" style="margin-bottom: 10px;">
					<text class="cuIcon-titles " style="color: #1E5EFF;"></text>
					<text style="color: #000000;font-weight: bold;font-size: 30rpx;">
						合同续签记录
					</text>
				</view>
				<view v-for="(item, index) in dataObj.contractRenewals" :key="index">
					<view class="cu-form-group"
						style="background-color: #F4F4F4;border-radius: 15px;margin-top: 15rpx;">
						<view class="title" style="font-size: 16px;">续签开始时间</view>
						<input v-model="item.contractStartTime" placeholder="请输入" name="input"
							style="text-align:right;font-size: 20rpx;" disabled />
					</view>
					<view class="cu-form-group"
						style="background-color: #F4F4F4;border-radius: 15px;margin-top: 15rpx;">
						<view class="title" style="font-size: 16px;">续签结束时间</view>
						<input v-model="item.contractEndTime" placeholder="请输入" name="input"
							style="text-align:right;font-size: 20rpx;" disabled />
					</view>
					<view class="cu-form-group"
						style="background-color: #F4F4F4;border-radius: 15px;margin-top: 15rpx;">
						<view class="title" style="font-size: 16px;">详情</view>
						<input v-model="item.details" placeholder="请输入" name="input"
							style="text-align:right;font-size: 20rpx;" disabled />
					</view>
				</view>
				<view v-if="contractType==1">
					<text class="red-tag">建议签订劳务合同</text>
				</view>
				<view style="margin: 20rpx 0;">
					<radio-group class="block" v-model="contractType" @change="RadioChange">
						<view>
							<text style="color: #101317;margin-left: 20rpx;margin-right: 50rpx;">合同类型</text>
							<radio value="1" :checked="contractType==1?true:false">
								<text style="margin-left: 20rpx;z-index:9;color:#B8B8B8;">劳务合同</text>
							</radio>
							<radio value="2" :checked="contractType==2?true:false" style="margin-left: 15px;">
								<text style="margin-left: 20rpx;z-index:9;color:#B8B8B8;">劳动合同</text>
							</radio>
						</view>
					</radio-group>
				</view>
				<!-- <view style="margin: 20rpx 0;">
					<radio-group class="block" v-model="contractType" @change="RadioChange">
						<view>
							<text
								style="font-size: 14rpx;color: #101317;margin-left: 20rpx;margin-right: 50rpx;">合同类型</text>
							<radio value="劳务合同" :checked="contractType=='劳务合同'?true:false">
								<text style="margin-left: 20rpx;z-index:9;color:#B8B8B8;font-size: 14rpx;">劳务合同</text>
							</radio>
							<radio value="劳工合同" :checked="contractType=='劳工合同'?true:false" style="margin-left: 15px;">
								<text style="margin-left: 20rpx;z-index:9;color:#B8B8B8;font-size: 14rpx;">劳工合同</text>
							</radio>
						</view>
					</radio-group>
				</view> -->
				<view class="cu-form-group" style="background-color: #F4F4F4;border-radius: 15px;margin-top: 15rpx;">
					<view class="title" style="font-size: 16px;">合同开始日期</view>
					<!-- <uni-datetime-picker v-model="createTime" type="line" clear-icon>
						<view style="text-align:right;margin-right: 20rpx;font-size: 20rpx;">
							{{createTime!=''?createTimeShow:'请选择'}}
						</view>
					</uni-datetime-picker> -->
					<picker mode="date" :value="createTime" @change="DateChange">
						<view style="text-align:right;font-size: 20rpx;line-height: 15px;">
							{{createTime != '' ? createTime : '请选择'}}
						</view>
					</picker>
				</view>
				<view class="cu-form-group" style="background-color: #F4F4F4;border-radius: 15px;margin-top: 15rpx;">
					<view class="title" style="font-size: 16px;">合同结束日期</view>
					<!-- <uni-datetime-picker v-model="endTime" type="line" clear-icon>
						<view style="text-align:right;margin-right: 20rpx;font-size: 20rpx;">
							{{endTime!=''?endTimeShow:'请选择'}}
						</view>
					</uni-datetime-picker> -->
					<picker mode="date" :value="endTime" @change="DateChangeEndTime">
						<view style="text-align:right;font-size: 20rpx;line-height: 15px;">
							{{endTime != '' ? endTime: '请选择'}}
						</view>
					</picker>
				</view>
				<view class="cu-form-group" style="background-color: #F4F4F4;border-radius: 15px;margin-top: 15rpx;">
					<view class="title" style="font-size: 16px;">合同签订日期</view>
					<!-- <uni-datetime-picker v-model="signTime" type="line" clear-icon>
						<view style="text-align:right;margin-right: 20rpx;font-size: 20rpx;">
							{{signTime!=''?signTimeShow:'请选择'}}
						</view>
					</uni-datetime-picker> -->
					<picker mode="date" :value="signTime" @change="DateChangeSignTime">
						<view style="text-align:right;font-size: 20rpx;line-height: 15px;">
							{{signTime != '' ? signTime : '请选择'}}
						</view>
					</picker>
				</view>
				<view class="cu-form-group" style="background-color: #E2E2E2;border-radius: 15px;margin-top: 15rpx;">
					<view class="title" style="font-size: 16px;">合同间隔时间</view>
					<input v-model="daysFromSigning" disabled placeholder="" name="input"
						style="text-align:right;font-size: 20rpx;" />
				</view>
				<!-- <view class="cu-form-group" style="background-color: #F4F4F4;border-radius: 15px;margin-top: 15rpx;">
					<view class="title">续签开始日期</view> -->
				<!-- <uni-datetime-picker v-model="createTime" type="line" clear-icon>
						<view style="text-align:right;margin-right: 20rpx;font-size: 20rpx;">
							{{createTime!=''?createTimeShow:'请选择'}}
						</view>
					</uni-datetime-picker> -->
				<!-- <picker mode="date" :value="createTime" @change="DateChange">
						<view style="text-align:right;font-size: 20rpx;line-height: 15px;">
							{{createTime}}
						</view>
					</picker>
				</view>
				<view class="cu-form-group" style="background-color: #F4F4F4;border-radius: 15px;margin-top: 15rpx;">
					<view class="title">续签结束日期</view> -->
				<!-- <uni-datetime-picker v-model="endTime" type="line" clear-icon>
						<view style="text-align:right;margin-right: 20rpx;font-size: 20rpx;">
							{{endTime!=''?endTimeShow:'请选择'}}
						</view>
					</uni-datetime-picker> -->
				<!-- <picker mode="date" :value="endTime" @change="DateChangeEndTime">
						<view style="text-align:right;font-size: 20rpx;line-height: 15px;">
							{{endTime}}
						</view>
					</picker>
				</view>	 -->
			</view>

			<!-- <view
				style="background-color: #fff; margin-top: 10px;display: flex;align-items: center;justify-content: space-between;">
				<view
					style="background-color: rgba(244, 244, 244, 1);width: 170px;height: 50px;text-align: center;padding: 15px 0;border-radius: 10px;">
					<text style="color: #101317;font-family: PingFang SC, PingFang SC;">
						续签合同开始日期
					</text>
				</view>
				<view
					style="background-color: #F4F4F4;width: 170px;height: 50px;text-align: center;padding: 15px 0;border-radius: 10px;">
					<text style="color: #101317;font-family: PingFang SC, PingFang SC;">
						续签合同结束日期
					</text>
				</view>
			</view> -->
			<!-- <view style="margin-top: 20px;background-color: #F9F9F9;border-radius: 10px;padding: 20px 30px;">
				<view style="display: flex;">
					<view style="width: 20px;height: 20px;background-color: #34B483;border-radius: 50%;"></view>
					<span style="margin-left: 15px;color:#101317;font-weight: 500;">合同附件</span>
					<image class="nav-right-image" src="@/static/images/xiazai.png"></image>
					<a style="margin-left: 15px;color: #4591FE;" @click="reUpload">重新上传</a>
				</view>
				<view style="display: flex;margin-top: 15px;">
					<view style="width: 20px;height: 20px;background-color: #34B483;border-radius: 50%;"></view>
					<span style="margin-left: 15px;color:#101317;font-weight: 500;">合同补充条款福建</span>
					<image class="nav-right-image" src="@/static/images/xiazai.png"></image>
				</view>
			</view> -->
			<view style="padding: 15rpx;margin-top: 10rpx;">
				<view class="action" style="margin-bottom: 10px;">
					<text class="cuIcon-titles " style="color: #1E5EFF;"></text>
					<text style="color: #000000;font-weight: bold;font-size: 30rpx;">
						合同附件上传
					</text>
				</view>
				<view style="margin-top: 30rpx;" class="example-body">
					<uni-file-picker limit="5" file-mediatype="image" @select="select"
						@delete="deleteFile"></uni-file-picker>
				</view>
			</view>

			<view style="padding: 15rpx;margin-top: 10rpx;">
				<view class="action" style="margin-bottom: 10px;">
					<text class="cuIcon-titles " style="color: #1E5EFF;"></text>
					<text style="color: #000000;font-weight: bold;font-size: 30rpx;">
						合同补充条款上传
					</text>
				</view>
				<view style=" margin-top: 30rpx;" class="example-body">
					<uni-file-picker limit="5" file-mediatype="image" @select="selectTwo"
						@delete="deleteFileTwo"></uni-file-picker>
				</view>
			</view>
			<view style="display: flex;margin-top: 15px;justify-content: space-between;align-items: center;">
				<view @click="submit"
					style="padding: 30rpx 110rpx; margin-left: 20rpx;margin-top: 20rpx; background-color: rgba(30, 94, 255, 1);border-radius: 30rpx;color: #FFFFFF;">
					提交审核
				</view>
				<view @click="save"
					style="padding: 30rpx 110rpx;margin-left: 20rpx;margin-top: 20rpx;border-radius: 30rpx;background-color: rgba(255, 173, 4, 1); color: #FFFFFF;">
					保存
				</view>
			</view>
			<uni-popup ref="submitFlag" background-color="#fff" :mask-click="false">
				<view
					style="text-align: center;background-color: #FFFFFF;padding: 11rpx;width: 580rpx;height: 470rpx;border-radius: 42rpx;">
					<view>
						<view class="submit-item">
							<image class="submit-icon" src="@/static/duihaoblue.png" />
						</view>
						<view style="margin-top: 28rpx;">
							<text class="submit-text">合同审核已经提交</text>
						</view>
						<view style="color: rgba(150, 150, 150, 1); margin-top: 23rpx;">
							<text>已提醒审核人员进行审核</text>
						</view>
						<button @click="sureOne" style="border-radius: 20rpx; background-color: rgba(69, 145, 254, 1);
									color: rgba(255, 255, 255, 1);width: 300rpx;margin-top: 27rpx;">确定</button>
					</view>
				</view>
			</uni-popup>
			<uni-popup ref="draftsFlag" background-color="#fff" :mask-click="false">
				<view>
					<view
						style="text-align: center;background-color: #FFFFFF;padding: 11rpx;width: 580rpx;height: 470rpx;border-radius: 42rpx;">
						<view class="submit-item">
							<image class="submit-icon" src="@/static/drafts.png" />
						</view>
						<view style="margin-top: 28rpx;">
							<text class="submit-text">已保存进草稿箱</text>
						</view>
						<view style="color: rgba(150, 150, 150, 1); margin-top: 23rpx;">
							<text>您可以进入草稿箱查看</text>
						</view>
						<button @click="sureThree" style="border-radius: 20rpx; background-color: rgba(69, 145, 254, 1);
					color: rgba(255, 255, 255, 1);width: 300rpx;margin-top: 27rpx;">确定</button>
					</view>
				</view>
			</uni-popup>
		</view>
	</view>
</template>

<script>
	import moment from 'moment';
	export default {
		data() {
			return {
				id: Math.floor(Math.random() * 10000000000000000000) + Date.now(),
				daysFromSigning: '',
				contractType: 2,
				createTime: '',
				endTime: '',
				signTime: '',
				userId: '',
				screenHeight: uni.getSystemInfoSync().windowHeight,
				dataObj: {
					enterFactoryTime: '',
					birthday: '',
				},
				contractFilesList: [],
				contractFiles: [],
				contractSupplementsList: [],
				contractSupplements: [],
			}
		},
		mounted() {

		},
		watch: {
			userId: {
				immediate: true,
				handler(val, old) {
					console.log("dataObject.userId值变化")
					console.log(val)
					console.log(old)
					this.userId = val;
					if (this.userId != '') {
						this.queryUserByUserId()
					}
				},
			},
			createTime: {
				immediate: true,
				handler(val, old) {
					this.count()
				},
			},
			endTime: {
				immediate: true,
				handler(val, old) {
					this.count()
				},
			}
		},
		computed: {
			createTimeShow: function() {
				return moment(this.createTime).isValid() ? moment(this.createTime).format('MM-DD') : moment().format(
					'MM-DD')
			},
			endTimeShow: function() {
				return moment(this.endTime).isValid() ? moment(this.endTime).format('MM-DD') : moment().format(
					'MM-DD')
			}
		},
		methods: {
			queryUserByUserId() {
				this.$http.get('/crm_user/crmUser/queryById', {
					params: {
						id: this.userId
					}
				}).then(res => {
					console.log("res", res)
					if (res.data.success) {
						let data = res.data.result
						this.dataObj.company_dictText = data.company_dictText;
						this.dataObj.company = data.company;
						this.dataObj.sex_dictText = data.sex_dictText;
						this.dataObj.sex = data.sex;
						this.dataObj.idCard = data.idCard;
						this.dataObj.idCardAddress = data.idCardAddress;
						this.dataObj.avatar = data.avatar;
						this.dataObj.workNumber = data.workNo;
						this.dataObj.phone = data.phone;
						this.dataObj.age = data.age;
						this.dataObj.birthday = data.birthday;
						this.dataObj.inTime = data.proposedEmploymentDate != null ? data.proposedEmploymentDate : '';
						this.dataObj.workAge = data.seniority;
						this.dataObj.post = data.post;
						this.dataObj.classification = data.classification;
						this.dataObj.departName = data.departName;
						this.dataObj.freightBasis_dictText = data.freightBasis_dictText;
						this.dataObj.freightBasis = data.freightBasis;
						this.dataObj.classes = data.classes;
						this.dataObj.realname = data.realname;
						this.dataObj.departIds_dictText = data.departIds_dictText
						this.dataObj.username = data.username
						//设置默认合同类型
						if ((this.dataObj.sex == 1 && this.dataObj.age >= 60) || (this.dataObj.sex == 2 && this
								.dataObj.age >=
								40 && this.dataObj.postType == 1) || (this.dataObj.sex == 2 && this.dataObj.age >=
								40 &&
								this.dataObj.postType == 2)) {
							this.contractType = 1
						} else {
							this.contractType = 2
						}

						this.dataObj.contractRenewals = data.contractRenewals.length > 0 ? data.contractRenewals :
							[{
								createTime: '',
								contractStartTime: '',
								contractEndTime: '',
								details: '',
							}]
					}
				}).catch(err => {
					console.log(err);
				});
			},
			RadioChange(e) {
				this.contractType = e.detail.value
			},
			DateChange(e) {
				this.createTime = e.detail.value
			},
			count() {
				if (this.endTime != '' && this.createTime != '') {
					var date1 = new Date(this.createTime);
					var date2 = new Date(this.endTime);
					var date = (date2.getTime() - date1.getTime()) / (1000 * 60 * 60 * 24); /*不用考虑闰年否*/
					if (date >= 0) {
						this.daysFromSigning = date
					} else {
						this.$tip.toast('开始时间不能大于结束时间')
						this.daysFromSigning = ''
					}
				}
			},
			DateChangeEndTime(e) {
				this.endTime = e.detail.value
			},
			DateChangeSignTime(e) {
				this.signTime = e.detail.value
			},
			PickerChangeOne(e) {
				this.indexOne = e.detail.value
			},
			PickerChangeTwo(e) {
				this.indexTwo = e.detail.value
			},
			PickerChangeThree(e) {
				this.indexThree = e.detail.value
			},
			reUpload() {
				console.log('重新上传')
			},
			submit() {
				const that = this
				this.uploadFileOne(this.contractFilesList);
				this.uploadFileTwo(this.contractSupplementsList);
				setTimeout(() => {
					this.$http.post('/crm_contract/crmContract/add', {
						"approvalStatus": "2",
						"contractEndTime": this.endTime + " 00:00:00",
						"contractFiles": this.contractFiles,
						"contractNo": Math.floor(Math.random() * 10000000000000000000) + Date.now(),
						"contractSigningTime": this.signTime + " 00:00:00",
						"contractStartTime": this.createTime + " 00:00:00",
						"contractSupplements": this.contractSupplements,
						"contractType": this.contractType,
						"daysFromSigning": this.dataObj.daysFromSigning,
						"id": this.id,
						"userId": this.userId,
						"signType": "2",
						"age": this.dataObj.age,
						"birthday": this.dataObj.birthday,
						"company": this.dataObj.company,
						"departIds": this.dataObj.departIds,
						"enterFactoryTime": this.dataObj.enterFactoryTime,
						"idCard": this.dataObj.idCard,
						"phone": this.dataObj.phone,
						"post": this.dataObj.post,
						"realname": this.dataObj.realname,
						"seniority": this.dataObj.workAge,
						"workNo": this.dataObj.workNumber,
						"classification": this.dataObj.classification,
						"departName": this.dataObj.departName,
						"freightBasis": this.dataObj.freightBasis,
						"classes": this.dataObj.classes,

					}).then(res => {
						if (res.data.success) {
							setTimeout(() => {
								this.$http.post(
										'/crm_contract/crmContract/submitTrial/' +
										this.id)
									.then(res => {
										if (res.data.success) {
											this.$refs.submitFlag.open('center')
										} else {
											this.$tip.toast('提交审核失败')
										}
									}).catch(() => {
										this.$tip.loaded();
										this.$tip.toast('提交审核失败')
									});
							}, 100)
						} else {
							this.$tip.toast(res.data.message)
						}
					}).catch(() => {
						this.$tip.loaded();
						this.$tip.toast('提交失败')
					});
				}, 500)
			},
			sureOne() {
				this.$refs.submitFlag.close()
				uni.navigateTo({
					url: '/pages/contract/index'
				})
			},
			save() {
				this.uploadFileOne(this.contractFilesList);
				this.uploadFileTwo(this.contractSupplementsList);
				setTimeout(() => {
					this.$http.post('/crm_contract/crmContract/add', {
						"approvalStatus": "1",
						"contractEndTime": this.endTime + " 00:00:00",
						"contractFiles": this.contractFiles,
						"contractNo": Math.floor(Math.random() * 10000000000000000000) + Date.now(),
						"contractSigningTime": this.signTime + " 00:00:00",
						"contractStartTime": this.createTime + " 00:00:00",
						"contractSupplements": this.contractSupplements,
						"contractType": this.contractType,
						"daysFromSigning": this.dataObj.daysFromSigning,
						"id": this.id,
						"userId": this.userId,
						"signType": "2",
						"age": this.dataObj.age,
						"birthday": this.dataObj.birthday,
						"company": this.dataObj.company,
						"departIds": this.dataObj.departIds,
						"enterFactoryTime": this.dataObj.enterFactoryTime,
						"idCard": this.dataObj.idCard,
						"phone": this.dataObj.phone,
						"post": this.dataObj.post,
						"realname": this.dataObj.realname,
						"seniority": this.dataObj.workAge,
						"workNo": this.dataObj.workNumber,
						"classification": this.dataObj.classification,
						"departName": this.dataObj.departName,
						"freightBasis": this.dataObj.freightBasis,
						"classes": this.dataObj.classes,

					}).then(res => {
						if (res.data.success) {
							this.$refs.draftsFlag.open('center')
						} else {
							this.$tip.toast(res.data.message)
						}
					}).catch(() => {
						this.$tip.loaded();
						this.$tip.toast('提交失败')
					});
				}, 500)
			},
			sureThree() {
				this.$refs.draftsFlag.close()
				uni.navigateTo({
					url: '/pages/contract/contractDrafts/index'
				})
			},
			// 获取上传状态
			select(e) {
				console.log('选择文件：', e)
				// this.imageValue.push(e.tempFilePaths[0])
				this.contractFilesList.push(e.tempFilePaths[0])
			},
			deleteFile(e) {
				console.log('移除文件：', e)
				this.contractFilesList.splice(e.tempFilePaths, 1)
			},
			// 获取上传状态
			selectTwo(e) {
				console.log('选择文件：', e)
				// this.imageValue.push(e.tempFilePaths[0])
				this.contractSupplementsList.push(e.tempFilePaths[0])
			},
			deleteFileTwo(e) {
				console.log('移除文件：', e)
				this.contractSupplementsList.splice(e.tempFilePaths, 1)
			},
			uploadFileOne(fileList) {
				const that = this
				fileList.forEach((item) => {
					that.$http.upload(that.$config.apiUrl + '/sys/common/upload', {
						filePath: item,
						name: 'file'
					}).then(res => {
						that.contractFiles.push({
							contractFile: res.data.message,
							contractId: Math.floor(Math.random() * 10000000000000000000) + Date
								.now(),
							id: Math.floor(Math.random() * 10000000000000000000) + Date.now()
						})
					}).catch(err => {
						that.$tip.error(err.data.message)
					});
				})
			},
			uploadFileTwo(fileList) {
				const that = this
				fileList.forEach((item) => {
					that.$http.upload(that.$config.apiUrl + '/sys/common/upload', {
						filePath: item,
						name: 'file'
					}).then(res => {
						that.contractSupplements.push({
							contractSupplementFile: res.data.message,
							contractId: Math.floor(Math.random() * 10000000000000000000) + Date
								.now(),
							id: Math.floor(Math.random() * 10000000000000000000) + Date.now()
						})
					}).catch(err => {
						that.$tip.error(err.data.message)
					});
				})
			}
		}
	}
</script>

<style>
	.cu-form-group {
		background-color: #ffffff;
		line-height: 15px;
		padding: 0.5px 15px;
		display: flex;
		align-items: center;
		min-height: 42px;
		justify-content: space-between;
	}

	.cu-form-group uni-picker .picker {
		line-height: 15px;
		font-size: 15px;
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
		width: 100%;
		text-align: right;
	}

	.cu-form-group uni-picker::after {
		font-family: cuIcon;
		line-height: 15px;
		display: block;
		content: "\e6a3";
		position: absolute;
		font-size: 17px;
		color: #8799a3;
		width: 31px;
		text-align: center;
		top: 0;
		bottom: 0;
		right: -10px;
		margin: auto;
	}

	.cu-form-group .title {
		text-align: justify;
		padding-right: 9px;
		font-size: 9px;
		position: relative;
		height: 32px;
		line-height: 32px;
	}

	/deep/ .uni-radio-input {
		width: 15px;
		height: 15px;
	}

	.nav-right-image {
		width: 40rpx;
		height: 40rpx;
		margin-left: 15px;
	}

	.submit-text {

		font-size: 32rpx;
	}

	.submit-icon {
		width: 118rpx;
		height: 118rpx;
		margin-top: 58rpx;
	}

	.red-tag {
		width: 120px;
		background-color: #fdc1be;
		color: #ff261b;
		text-align: center;
		margin-left: 5px;
		display: inline-block;
		padding: 7px;
		font-size: 25rpx;
		border-radius: 20px;
	}
</style>